package com.example.litemall.admin.api.service.impl;

import com.example.litemall.admin.api.domain.LitemallCategory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.example.litemall.admin.api.mapper.LitemallCategoryMapper;
import com.example.litemall.admin.api.service.LitemallCategoryService;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class LitemallCategoryServiceImpl implements LitemallCategoryService{

    @Resource
    private LitemallCategoryMapper litemallCategoryMapper;

    @Override
    public List<LitemallCategory> getCategoryByPid(Integer pid) {
        Example example = new Example(LitemallCategory.class);
        example.or().andEqualTo("pid",pid).andEqualTo("deleted",false);
        List<LitemallCategory> categories = litemallCategoryMapper.selectByExample(example);
        return categories;
    }
}
